package com.platform.service.impl;

import com.platform.cache.J2CacheUtils;
import com.platform.dao.DynamicCategoryDao;
import com.platform.entity.DynamicCategoryEntity;
import com.platform.service.DynamicCategoryService;
import com.platform.util.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * Service实现类
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2018-08-21 17:19:56
 */
@Service("dynamicCatetgoryService")
public class DynamicCategoryServiceImpl implements DynamicCategoryService {
    @Autowired
    private DynamicCategoryDao dynamicCatetgoryDao;

    @Override
    public DynamicCategoryEntity queryObject(Integer id) {
        return dynamicCatetgoryDao.queryObject(id);
    }

    @Override
    public List<DynamicCategoryEntity> queryList(Map<String, Object> map) {
        return dynamicCatetgoryDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return dynamicCatetgoryDao.queryTotal(map);
    }

    @Override
    public int save(DynamicCategoryEntity cmsCategory) {
        J2CacheUtils.clear(Constants.REDIS_COMMUNITY_KEY);
        return dynamicCatetgoryDao.save(cmsCategory);
    }

    @Override
    public int update(DynamicCategoryEntity cmsCategory) {
        J2CacheUtils.clear(Constants.REDIS_COMMUNITY_KEY);
        return dynamicCatetgoryDao.update(cmsCategory);
    }

    @Override
    public int delete(Integer id) {
        J2CacheUtils.clear(Constants.REDIS_COMMUNITY_KEY);
        return dynamicCatetgoryDao.delete(id);
    }

    @Override
    public int deleteBatch(Integer[] ids) {
        J2CacheUtils.clear(Constants.REDIS_COMMUNITY_KEY);
        return dynamicCatetgoryDao.deleteBatch(ids);
    }
}
